#include "stdafx.h"
#include "ThreadPool.h"

namespace syncLib
{


    ThreadPool::ThreadPool(size_t threads)
    {
        impl_.reset(new ThreadPoolImpl(threads));
    }

    ThreadPool::~ThreadPool(void)
    {
        WaitForDone();
    }

    void ThreadPool::ScheduleTask(ITask* task)
    {
        impl_->ScheduleTask(task);
    }

    int ThreadPool::MaxThreadCount() const
    {
        return impl_->MaxThreadCount();
    }

    int ThreadPool::ActiveThreadCount() const
    {
        return impl_->ActiveThreadCount();
    }

    bool ThreadPool::WaitForDone(int msecs /*= -1*/)
    {
        return impl_->WaitForDone(msecs);
    }

};